package com.bsoft.template.web.assets;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.bsoft.template.common.Result;
import com.bsoft.template.entity.assets.AssetsBf;
import com.bsoft.template.service.assets.AssetsBfService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("assetsBf")
public class AssetsBfController {

    @Autowired
    private AssetsBfService assetsBfService;

    @PostMapping("/save")
    public Result save(@RequestBody AssetsBf assetsBf) {
        return assetsBfService.save(assetsBf);
    }

    @GetMapping("/getAssetsBf")
    public Result getAssetsBf(int type, String pzh) {
        QueryWrapper<AssetsBf> wrapper = new QueryWrapper<>();
        wrapper.eq("type", type);
        wrapper.eq("pzh", pzh);
        wrapper.orderByDesc("create_time");
        return assetsBfService.list(wrapper);
    }
}
